package com.easondongh.blog.filters;

import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.LogoutFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.websocket.SessionException;

/**
 * @author EasonDongH
 * @date 2020/4/1 16:46
 */
public class SysLogoutFilter extends LogoutFilter {
    @Override
    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        //在这里执行退出系统前需要清空的数据
        Subject subject = getSubject(request, response);
        String redirectUrl = getRedirectUrl(request, response, subject);
        subject.logout();
        issueRedirect(request, response, redirectUrl);

        return false;
    }
}
